project(etl-tests)

function(tetl_add_test _header _target)
  set(options OPTIONAL WILL_FAIL)
  cmake_parse_arguments(TETL_ADD_TEST_PREFIX "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

  add_executable("test_${_header}_${_target}" "${_target}.t.cpp")
  target_include_directories("test_${_header}_${_target}" PRIVATE "${CMAKE_SOURCE_DIR}/tests")
  target_compile_definitions("test_${_header}_${_target}" PRIVATE TETL_DEBUG=1 TETL_ENABLE_USER_CONFIG_HEADER_INCLUDE=1)
  target_link_libraries("test_${_header}_${_target}" PRIVATE tetl::etl tetl::compiler_options tetl::compiler_warnings tetl::code_coverage)

  add_test(NAME "${_header}.hpp: ${_target}" COMMAND "test_${_header}_${_target}")
  set_tests_properties("${_header}.hpp: ${_target}" PROPERTIES WILL_FAIL ${TETL_ADD_TEST_PREFIX_WILL_FAIL})
endfunction()

add_subdirectory("algorithm")
add_subdirectory("array")
add_subdirectory("bit")
add_subdirectory("bitset")
add_subdirectory("cctype")
add_subdirectory("cfloat")
add_subdirectory("charconv")
add_subdirectory("chrono")
add_subdirectory("cmath")
add_subdirectory("complex")
add_subdirectory("concepts")
add_subdirectory("cstddef")
add_subdirectory("cstdint")
add_subdirectory("cstdlib")
add_subdirectory("cstring")
add_subdirectory("exception")
add_subdirectory("expected")
add_subdirectory("flat_set")
add_subdirectory("format")
add_subdirectory("functional")
add_subdirectory("ios")
add_subdirectory("iterator")
add_subdirectory("limits")
add_subdirectory("linalg")
add_subdirectory("mdarray")
add_subdirectory("mdspan")
add_subdirectory("memory")
add_subdirectory("mutex")
add_subdirectory("numbers")
add_subdirectory("numeric")
add_subdirectory("optional")
add_subdirectory("random")
add_subdirectory("ranges")
add_subdirectory("ratio")
add_subdirectory("scope")
add_subdirectory("set")
add_subdirectory("span")
add_subdirectory("stack")
add_subdirectory("stdexcept")
add_subdirectory("string")
add_subdirectory("string_view")
add_subdirectory("tuple")
add_subdirectory("type_traits")
add_subdirectory("utility")
add_subdirectory("variant")
add_subdirectory("vector")
add_subdirectory("version")

add_subdirectory("experimental/freertos")
add_subdirectory("experimental/net")
add_subdirectory("experimental/stm32")
